package com.springcloud.market.api.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.function.Consumer;

@Slf4j
@Service
public class UserRegisterMessageHandler {
    @Bean
    public Consumer<Map<String, Object>> userRegisterConsumer() {
        return message -> {
            String phoneNumber = (String) message.get("phoneNumber");
            log.info("收到用户注册消息，开始发放礼品，库存-1，手机号: {}", phoneNumber);
            // 省略真正扣库存发放礼品逻辑
        };
    }
}
